package com.lie.think.c20;

import java.util.List;

/**
 * Created by lie on 2018/4/4.
 * 工具类，作为一个案例
 * 来演示使用了{@link UseCase}测试用例注解的情况
 */
public class PasswordUtils {

    @UseCase(id = 1, description = "密码应该至少包括一个数字")
    public boolean validatePassword(String password){
        return password.matches("\\w*\\d\\w*");
    }

    //加密
    @UseCase(id = 2)
    public String encryptPassword(String password){
        return new StringBuilder(password).reverse().toString();
    }

    @UseCase(id = 3, description = "密码不能和旧有的密码重复")
    public boolean checkForPassword(List<String> prePasswords, String password){
        return prePasswords.contains(password);
    }
}
